

 #: 58923      Sub-topic 3 - Disk Programming
Sb: #58585-#PROGRAMMING C-64
    03-Feb-85  15:13:41
Fm: Ken Kehl   70616,226
To: Ken Hurt   74546,303


  Ken, printing information to SEQ files is just like printing to the screen
with a few small changes.

  First the file must be opened.

  10 open1,8,3,"0:seqfile,s,w"
(the ,s,w means sequential,write. If you only want to read the file, this can
be left off, as the DOS assumes ,s,r if no type & direction are given.)

 then print the information to the file. (print means output, and the screen
just happens to be the default output device, that's all)

  20 print#1,"this is a textfile"

  then the file should be closed up.

  30 close 1

  If you are using a string as a filename, you just concatenate the name to
match proper syntax

  5 input"filename";f$:iff$=""goto5
  10 open1,8,3,"0:"+f$+",s,w"

 continued in reply...enter rr

* Reply:
	58924
(UA RE T): 

 #: 58924      Sub-topic 3 - Disk Programming
Sb: #58923-#PROGRAMMING C-64
    03-Feb-85  15:15:22
Fm: Ken Kehl   70616,226
To: Ken Kehl   70616,226 (X)


  You can also print strings to the file from memory (which is what you ar	 really asking about I think)

 5 fort=1to10:a$(t)="file"+str$(t):next
 6 open1,8,3,"0:filename,s,w"
 7 fort=1to10:print#1,a$(t);:next
 8 close1

 Just like the screen, if you don't put a semicolon after each print#, a
carriage return chr$(13) is put in the file at the next print# statement. If
you are retrieving information which is to be put on the screen, this can be
handy, as the proper carriage returns can be built into the file.

 Don't forget that print# isn't abbreviated as ?# but as p shift R.

  	  clarify all of this, it might help to experiment by using the screen as a
non-default output device.

  10 open1,3:rem device 3=screen
  20 print#1,"text"
  30 close1

  continued in reply...

* Reply:
	58925
* RR 58923 +
(UA RE T): 

 #: 58925      Sub-topic 3 - Disk Programming
Sb: #58924-PROGRAMMING C-64
    03-Feb-85  15:17:39
Fm: Ken Kehl   70616,226
To: Ken Kehl   70616,226 (X)


  Information can be retrieved from the SEQ file with either GET# or INPUT#
commands. If there is a possibility that the	 ile may contain a null string
-chr$(0)- you will have to allow for this before performing any operations on
the string. using the statement a$=a$+cH(0) will relace the null string with a
chr$(0) and allow operations like print asc(a$) without errors.

  GET# receives info one byte at a time, while INPUT# will gather strings until
it comes across a terminator like a comma, or a carriage return (a chr$(0)
might cause problems here, and you should test for input of null strings -
ifa$=""then whatever...)
  Y	  can close a file as many times as you want, but if you try to retrieve
data from an unopened file, you will get an error.

  Here's a simple SEQ file reader.
 10 open1,8,3,"0:filename"
 20 get#1,a$:printa$;:ifst=0then20
 30 close1

 When the last byte of a file is read, the value of ST (the status variable)
becomes non zero, and the program ends.
 You will have to ask someone else about relative files.

   WHEW! That should get you started.

                            Ken

* RR 58923
(UA RE T): 